import type { Component } from 'vue';
import type { ComponentType } from './types/index';

/**
 * Component list, register here to setting it in the form
 */
import { StrengthMeter } from '/@/components/StrengthMeter';
import { CountdownInput } from '/@/components/CountDown';
// Gentle 组件
import {
  GentleAlert,
  GentleAreaSelect,
  GentleAutoComplete,
  GentleButton,
  GentleCron,
  GentleCascader,
  GentleColorPicker,
  GentleCheckbox,
  GentleCheckboxSingle,
  GentleDatePicker,
  GentleDateRange,
  GentleTimePicker,
  GentleTimeRange,
  GentleMonthPicker,
  GentleWeekPicker,
  GentleDivider,
  GentleEditor,
  GentleGroupTitle,
  GentleIconPicker,
  GentleInput,
  GentleInputPassword,
  GentleInputGroup,
  GentleInputSearch,
  GentleTextarea,
  GentleInputNumber,
  GentleLink,
  GentleOpenData,
  GentleOrganizeSelect,
  GentleDepSelect,
  GentlePosSelect,
  GentleGroupSelect,
  GentleRoleSelect,
  GentleUserSelect,
  GentleUsersSelect,
  GentleQrcode,
  GentleBarcode,
  GentleRadio,
  GentleRate,
  GentleSelect,
  GentleSlider,
  GentleSign,
  GentleSwitch,
  GentleText,
  GentleTreeSelect,
  GentleUploadFile,
  GentleUploadImg,
  GentleUploadImgSingle,
  GentleRelationForm,
  GentleRelationFormAttr,
  GentlePopupSelect,
  GentlePopupTableSelect,
  GentlePopupAttr,
  GentleNumberRange,
  GentleCalculate,
  GentleInputTable,
} from '/@/components/Gentle';

const componentMap = new Map<ComponentType, Component>();

componentMap.set('StrengthMeter', StrengthMeter);
componentMap.set('InputCountDown', CountdownInput);

componentMap.set('InputGroup', GentleInputGroup);
componentMap.set('InputSearch', GentleInputSearch);
componentMap.set('MonthPicker', GentleMonthPicker);
componentMap.set('WeekPicker', GentleWeekPicker);

componentMap.set('Alert', GentleAlert);
componentMap.set('AreaSelect', GentleAreaSelect);
componentMap.set('AutoComplete', GentleAutoComplete);
componentMap.set('Button', GentleButton);
componentMap.set('Cron', GentleCron);
componentMap.set('Cascader', GentleCascader);
componentMap.set('ColorPicker', GentleColorPicker);
componentMap.set('Checkbox', GentleCheckbox);
componentMap.set('GentleCheckboxSingle', GentleCheckboxSingle);
componentMap.set('DatePicker', GentleDatePicker);
componentMap.set('DateRange', GentleDateRange);
componentMap.set('TimePicker', GentleTimePicker);
componentMap.set('TimeRange', GentleTimeRange);
componentMap.set('Divider', GentleDivider);
componentMap.set('Editor', GentleEditor);
componentMap.set('GroupTitle', GentleGroupTitle);
componentMap.set('Input', GentleInput);
componentMap.set('InputPassword', GentleInputPassword);
componentMap.set('Textarea', GentleTextarea);
componentMap.set('InputNumber', GentleInputNumber);
componentMap.set('IconPicker', GentleIconPicker);
componentMap.set('Link', GentleLink);
componentMap.set('OrganizeSelect', GentleOrganizeSelect);
componentMap.set('DepSelect', GentleDepSelect);
componentMap.set('PosSelect', GentlePosSelect);
componentMap.set('GroupSelect', GentleGroupSelect);
componentMap.set('RoleSelect', GentleRoleSelect);
componentMap.set('UserSelect', GentleUserSelect);
componentMap.set('UsersSelect', GentleUsersSelect);
componentMap.set('Qrcode', GentleQrcode);
componentMap.set('Barcode', GentleBarcode);
componentMap.set('Radio', GentleRadio);
componentMap.set('Rate', GentleRate);
componentMap.set('Select', GentleSelect);
componentMap.set('Slider', GentleSlider);
componentMap.set('Sign', GentleSign);
componentMap.set('Switch', GentleSwitch);
componentMap.set('Text', GentleText);
componentMap.set('TreeSelect', GentleTreeSelect);
componentMap.set('UploadFile', GentleUploadFile);
componentMap.set('UploadImg', GentleUploadImg);
componentMap.set('UploadImgSingle', GentleUploadImgSingle);
componentMap.set('BillRule', GentleInput);
componentMap.set('ModifyUser', GentleInput);
componentMap.set('ModifyTime', GentleInput);
componentMap.set('CreateUser', GentleOpenData);
componentMap.set('CreateTime', GentleOpenData);
componentMap.set('CurrOrganize', GentleOpenData);
componentMap.set('CurrPosition', GentleOpenData);
componentMap.set('RelationForm', GentleRelationForm);
componentMap.set('RelationFormAttr', GentleRelationFormAttr);
componentMap.set('PopupSelect', GentlePopupSelect);
componentMap.set('PopupTableSelect', GentlePopupTableSelect);
componentMap.set('PopupAttr', GentlePopupAttr);
componentMap.set('NumberRange', GentleNumberRange);
componentMap.set('Calculate', GentleCalculate);
componentMap.set('InputTable', GentleInputTable);

export function add(compName: ComponentType, component: Component) {
  componentMap.set(compName, component);
}

export function del(compName: ComponentType) {
  componentMap.delete(compName);
}

export { componentMap };
